class EntityType:
    """
    表示实体类型
    """

    def __init__(self, type_name, aiml_code, node_label):
        """
        :param type_name: 类型名
        :param aiml_code: aiml匹配的代码
        :param node_label: neo4j查询的标签
        """
        self.type_name = type_name
        self.aiml_code = aiml_code
        self.node_label = node_label

    def __hash__(self):
        return hash(self.type_name)

    def __eq__(self, other):
        return self.type_name == other.type_name


class Entity:
    """
    实体类
    """

    def __init__(
            self, proper_name: str, entity_type: EntityType
    ):
        """
        :param proper_name: 实体名字
        :param entity_type: 实体所属类型
        """
        self.proper_name = proper_name
        self.entity_type = entity_type

    def __hash__(self):
        return hash(self.proper_name + self.entity_type.type_name)

    def __eq__(self, other):
        return self.proper_name == other.proper_name
